package string.nowcoder.easy;

import java.util.*;

/**
 * @author bruin_du
 * @description 电话号码
 * @date 2022/7/4 17:05
 **/
public class PhoneNumber {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int[] arr = new int[]{2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9};
        while(in.hasNextLine()) {
            int n = in.nextInt();
            in.nextLine();
            Set<String> set = new HashSet<>();
            for (int i = 0; i < n; i++) {
                String str = in.nextLine();
                String[] strings = str.split("-");
                StringBuilder sb = new StringBuilder();
                for (String string : strings) {
                    sb.append(string);
                }
                for (int j = 0; j < sb.length(); j++) {
                    char ch = sb.charAt(j);
                    if(Character.isUpperCase(ch)) {
                        sb.replace(j,j + 1,Integer.toString(arr[ch - 'A']));
                    }
                }
                sb.insert(3,"-");
                set.add(sb.toString());
            }
            List<String> list = Arrays.asList(set.toArray(new String[0]));
            Collections.sort(list);
            for (String s : list) {
                System.out.println(s);
            }
            System.out.println();
        }
    }
}
